﻿using System;
using System.IO;

namespace Gmantis.Zip
{
    public class ZipFile : IDisposable
    {
        // Fields
        internal Stream _batchStream;
        internal byte[] _buf;
        internal uint _bytesBeforeZip;
        internal string _comment;
        internal ZipEntryCollection _entries;
        internal string _fileName;
        internal CompressionLevelEnum _level;
        internal int _memoryThreshold;
        internal long _offset;
        internal bool _owHidden;
        internal bool _owReadOnly;
        internal bool _owSystem;
        internal string _password;
        internal uint _size;
        internal string _tempFileName;
        internal const int BUFFERSIZE = 0x40000;
        internal static byte[] CENTRAL_DIR_SIGN = new byte[] { 80, 0x4b, 5, 6 };
        internal static byte[] CENTRAL_DIR64_SIGN = new byte[] { 80, 0x4b, 6, 6 };
        internal static byte[] CENTRAL_DIR64L_SIGN = new byte[] { 80, 0x4b, 6, 7 };
        internal const char DIRSEPCHAR = '/';
        internal const string ERR_TOOLARGE_COMPRESSED = "Size is too large to be represented as an Int32, use SizeCompressedLong instead.";
        internal const string ERR_TOOLARGE_LENGTH = "Length is too large to be represented as an Int32, use LengthLong instead.";
        internal const string ERR_TOOLARGE_POSITION = "Position is too large to be represented as an Int32, use PositionLong instead.";
        internal const string ERR_TOOLARGE_UNCOMPRESSED = "Size is too large to be represented as an Int32, use SizeUncompressedLong instead.";
        internal const int ZIPFILEHEADERSIZE = 0x16;

        // Events
        public event ZipProgressEventHandler Progress;

        // Methods
        public ZipFile()
        {
            this._buf = new byte[0x40000];
            this._level = CompressionLevelEnum.DefaultCompression;
            this._fileName = string.Empty;
            this._comment = string.Empty;
            this._password = string.Empty;
            this._entries = new ZipEntryCollection(this);
            this._memoryThreshold = 0x80000;
            this._tempFileName = null;
            this._batchStream = null;
        }

        public ZipFile(Stream stream)
            : this(stream, false)
        {
        }

        public ZipFile(string fileName)
            : this(fileName, false)
        {
        }

        public ZipFile(Stream stream, bool create)
            : this()
        {
            if (create)
            {
                this.Create(stream);
            }
            else
            {
                this.Open(stream);
            }
        }

        public ZipFile(string fileName, bool create)
            : this()
        {
            if (create)
            {
                this.Create(fileName);
            }
            else
            {
                this.Open(fileName);
            }
        }

        internal void Add(Stream srcStream, string entryName, DateTime dateTime)
        {
            if (((this.FileName == null) || (this.FileName.Length == 0)) && (this._batchStream == null))
            {
                throw new ArgumentException(StringTables.GetString("Zip file is not open."));
            }
            string fileName = null;
            bool memory = true;
            using (Stream stream = this.OpenWriter(fileName, entryName, dateTime, memory))
            {
                long len = 0x7fffffffffffffffL;
                if (!this.StreamCopy(stream, srcStream, len, entryName))
                {
                    (stream as ZipEntryStreamWriter).Cancel();
                }
            }
        }

        internal void Add(string fileName, string entryName, DateTime dateTime)
        {
            if (File.Exists(fileName))
            {
                using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    this.Add(stream, entryName, dateTime);
                    return;
                }
            }
            if (!Directory.Exists(fileName))
            {
                throw new FileNotFoundException(string.Format(StringTables.GetString("File not found: '{0}'."), fileName));
            }
            this.OpenWriter(fileName, entryName, dateTime, true).Close();
        }

        internal bool CheckPassword(ZipEntry ze)
        {
            if (!ze.IsEncrypted)
            {
                return true;
            }
            bool flag = true;
            ZStreamReader reader = null;
            Stream fs = null;
            try
            {
                fs = this.OpenInternal(this.FileName, true, false);
                ze.ReadLocalHeader(fs);
                flag = new CryptStream(ze, fs).InitKeys();
            }
            finally
            {
                this.CloseInternal(fs);
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return flag;
        }

        public void Close()
        {
            this._size = 0;
            this._offset = 0L;
            this._bytesBeforeZip = 0;
            this._fileName = string.Empty;
            this._comment = string.Empty;
            this._password = string.Empty;
            this._entries.Clear();
        }

        public void CloseBatch()
        {
            if (this._batchStream != null)
            {
                this._batchStream.Close();
                this._batchStream = null;
            }
        }

        internal void CloseInternal(Stream s)
        {
            if ((this._batchStream == null) && (s != null))
            {
                s.Close();
            }
        }

        public void Create(Stream stream)
        {
            this.Close();
            this.CloseBatch();
            this.WriteCentralDir(stream);
            this._batchStream = stream;
        }

        public void Create(string fileName)
        {
            this.Close();
            using (FileStream stream = new FileStream(fileName, FileMode.Create))
            {
                this.WriteCentralDir(stream);
            }
            this._fileName = fileName;
        }

        internal void Extract(ZipEntry ze, string dstFileName)
        {
            string directoryName = Path.GetDirectoryName(dstFileName);
            if ((directoryName.Length > 0) && !Directory.Exists(directoryName))
            {
                throw new DirectoryNotFoundException(StringTables.GetString("Invalid destination folder: ") + directoryName);
            }
            if (Path.GetFileName(dstFileName).Length == 0)
            {
                dstFileName = Path.Combine(directoryName, Path.GetFileName(ze.FileName));
            }
            if (File.Exists(dstFileName))
            {
                FileInfo info = new FileInfo(dstFileName);
                FileAttributes attributes = info.Attributes;
                bool flag = (attributes & FileAttributes.ReadOnly) != 0;
                bool flag2 = (attributes & FileAttributes.Hidden) != 0;
                bool flag3 = (attributes & FileAttributes.System) != 0;
                if (flag && !this.OverwriteReadOnly)
                {
                    throw new UnauthorizedAccessException(StringTables.GetString("Cannot overwrite read-only file."));
                }
                if (flag2 && !this.OverwriteHidden)
                {
                    throw new UnauthorizedAccessException(StringTables.GetString("Cannot overwrite hidden file."));
                }
                if (flag3 && !this.OverwriteSystem)
                {
                    throw new UnauthorizedAccessException(StringTables.GetString("Cannot overwrite system file."));
                }
                if (flag)
                {
                    attributes &= ~FileAttributes.ReadOnly;
                }
                if (flag2)
                {
                    attributes &= ~FileAttributes.Hidden;
                }
                if (flag3)
                {
                    attributes &= ~FileAttributes.System;
                }
                if (info.Attributes != attributes)
                {
                    try
                    {
                        info.Attributes = attributes;
                    }
                    catch
                    {
                    }
                }
            }
            if ((ze._attExternal & 0x10) != 0)
            {
                if (!Directory.Exists(dstFileName))
                {
                    Directory.CreateDirectory(dstFileName);
                }
            }
            else
            {
                Stream dstStream = null;
                Stream srcStream = null;
                try
                {
                    dstStream = new FileStream(dstFileName, FileMode.Create, FileAccess.Write);
                    srcStream = this.OpenReader(ze);
                    if (!this.StreamCopy(dstStream, srcStream, ze.SizeUncompressedLong, dstFileName))
                    {
                        dstStream.Close();
                        File.Delete(dstFileName);
                    }
                }
                finally
                {
                    if (srcStream != null)
                    {
                        srcStream.Close();
                    }
                    if (dstStream != null)
                    {
                        dstStream.Close();
                    }
                }
            }
            if (File.Exists(dstFileName))
            {
                FileInfo info2 = new FileInfo(dstFileName);
                if (info2.Attributes != ze.Attributes)
                {
                    try
                    {
                        info2.Attributes = ze.Attributes;
                    }
                    catch
                    {
                    }
                }
            }
        }

        internal void Extract(int index, string dstFileName)
        {
            this.Extract(this.Entries[index], dstFileName);
        }

        private static long FindCentralDir(Stream fs)
        {
            long num = 0x10015L;
            long length = fs.Length;
            if (num > length)
            {
                num = length;
            }
            long num3 = 0L;
            long num4 = 0L;
            byte[] buffer = new byte[0x40000];
            while (num3 < num)
            {
                num3 = num4 + 0x40000L;
                if (num3 > num)
                {
                    num3 = num;
                }
                int count = (int)(num3 - num4);
                fs.Seek(-num3, SeekOrigin.End);
                if (fs.Read(buffer, 0, count) != count)
                {
                    throw new IOException(StringTables.GetString("Error reading data from Zip file (file may be corrupted)."));
                }
                for (int i = count - 4; i >= 0; i--)
                {
                    if (Match(buffer, CENTRAL_DIR_SIGN, i))
                    {
                        return (length - (num3 - i));
                    }
                }
                num4 += count - 3;
            }
            throw new ZipFileException(StringTables.GetString("Central dir not found."));
        }

        internal bool IsZip64()
        {
            if (this._offset >= 0x7fffffffL)
            {
                return true;
            }
            foreach (ZipEntry entry in this.Entries)
            {
                if (entry.IsZip64())
                {
                    return true;
                }
            }
            return (this.Entries.Count >= 0xffff);
        }

        public static bool IsZipFile(Stream stream)
        {
            bool flag;
            if (((stream == null) || (stream.Length < 0x16L)) || !stream.CanSeek)
            {
                return false;
            }
            long position = stream.Position;
            try
            {
                new ZipFile().Open(stream);
                flag = true;
            }
            catch
            {
                flag = false;
            }
            finally
            {
                stream.Position = position;
            }
            return flag;
        }

        public static bool IsZipFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                return false;
            }
            try
            {
                new ZipFile().Open(fileName);
                return true;
            }
            catch
            {
                return false;
            }
        }

        internal static bool Match(byte[] buf, byte[] find, int offset)
        {
            for (int i = 0; i < find.Length; i++)
            {
                if (buf[offset + i] != find[i])
                {
                    return false;
                }
            }
            return true;
        }

        public void Open(Stream stream)
        {
            this.Close();
            this.CloseBatch();
            this.OpenInternal(stream, true);
            this._batchStream = stream;
        }

        public void Open(string fileName)
        {
            if (!File.Exists(fileName))
            {
                this.Create(fileName);
            }
            else
            {
                Stream s = null;
                try
                {
                    s = this.OpenInternal(fileName, true, true);
                }
                finally
                {
                    this.CloseInternal(s);
                }
            }
        }

        public void OpenBatch()
        {
            this.CloseBatch();
            this._batchStream = this.OpenInternal(this.FileName);
        }

        internal Stream OpenInternal(string fileName)
        {
            return this.OpenInternal(fileName, false, true);
        }

        internal Stream OpenInternal(Stream fs, bool readEntries)
        {
            long num = FindCentralDir(fs);
            fs.Position = num;
            BinaryReader reader = new BinaryReader(fs);
            byte[] buf = reader.ReadBytes(CENTRAL_DIR_SIGN.Length);
            if ((buf.Length != CENTRAL_DIR_SIGN.Length) || !Match(buf, CENTRAL_DIR_SIGN, 0))
            {
                throw new ZipFileException(StringTables.GetString("This is not a Zip file (wrong signature)."), this.FileName);
            }
            ushort num2 = reader.ReadUInt16();
            ushort num3 = reader.ReadUInt16();
            ushort num4 = reader.ReadUInt16();
            ushort num5 = reader.ReadUInt16();
            this._size = reader.ReadUInt32();
            this._offset = reader.ReadUInt32();
            this._comment = string.Empty;
            short count = reader.ReadInt16();
            if (count > 0)
            {
                byte[] bytes = reader.ReadBytes(count);
                if (bytes.Length != count)
                {
                    throw new ZipFileException(StringTables.GetString("Zip file is corrupted (wrong comment size)."), this.FileName);
                }
                this._comment = ZipEncoding.Encoding.GetString(bytes, 0, bytes.Length);
            }
            if (((num2 != 0) || (num3 != 0)) || (num4 != num5))
            {
                throw new NotSupportedException(StringTables.GetString("Disk spanning not supported."));
            }
            if ((num5 != 0xffff) && (this._size < (num5 * 0x2e)))
            {
                throw new ZipFileException(StringTables.GetString("Zip file is corrupted (wrong header size)."), this.FileName);
            }
            this._bytesBeforeZip = 0;
            if (this._offset == 0xffffffffL)
            {
                fs.Position = num - 20L;
                buf = reader.ReadBytes(CENTRAL_DIR64L_SIGN.Length);
                if ((buf.Length != CENTRAL_DIR64L_SIGN.Length) || !Match(buf, CENTRAL_DIR64L_SIGN, 0))
                {
                    throw new ZipFileException(StringTables.GetString("Central dir 64 not found."));
                }
                reader.ReadInt32();
                long num7 = reader.ReadInt64();
                fs.Position = num7;
                buf = reader.ReadBytes(CENTRAL_DIR64_SIGN.Length);
                if ((buf.Length != CENTRAL_DIR64_SIGN.Length) || !Match(buf, CENTRAL_DIR64_SIGN, 0))
                {
                    throw new ZipFileException(StringTables.GetString("Central dir 64 not found."));
                }
                fs.Position += 0x2cL;
                this._offset = reader.ReadInt64();
            }
            if (readEntries)
            {
                this.ReadEntryHeaders(fs);
            }
            return fs;
        }

        internal Stream OpenInternal(string fileName, bool readOnly, bool readEntries)
        {
            if (this._batchStream != null)
            {
                return this._batchStream;
            }
            Stream fs = null;
            if (!readOnly)
            {
                try
                {
                    fs = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
                }
                catch
                {
                }
            }
            if (fs == null)
            {
                try
                {
                    fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                }
                catch
                {
                    fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                }
            }
            try
            {
                this.OpenInternal(fs, readEntries);
            }
            catch
            {
                fs.Close();
                throw;
            }
            this._fileName = fileName;
            return fs;
        }

        internal Stream OpenReader(ZipEntry ze)
        {
            ZStreamReader reader = null;
            Stream fs = null;
            try
            {
                fs = this.OpenInternal(this.FileName, true, false);
                ze.ReadLocalHeader(fs);
                if (ze.IsEncrypted)
                {
                    if ((this._password == null) || (this._password.Length == 0))
                    {
                        throw new ZipFileException(StringTables.GetString("Password not set: can't decrypt data."));
                    }
                    CryptStream baseStream = new CryptStream(ze, fs);
                    if (!baseStream.InitKeys())
                    {
                        throw new ZipFileException(StringTables.GetString("Invalid password: can't decrypt data."));
                    }
                    long sizeCompressed = ze.SizeCompressedLong - 12L;
                    reader = new ZStreamReader(baseStream, true, sizeCompressed, ze._method);
                }
                else
                {
                    reader = new ZStreamReader(fs, true, ze.SizeCompressedLong, ze._method);
                }
            }
            catch (Exception exception)
            {
                this.CloseInternal(fs);
                if (reader != null)
                {
                    reader.Close();
                }
                throw new ZipFileException(StringTables.GetString("Error extracting entry from Zip file."), ze.FileName, exception);
            }
            if ((reader != null) && (this._batchStream == null))
            {
                reader.OwnsBaseStream = true;
            }
            return reader;
        }

        internal Stream OpenWriter(string entryName, DateTime dateTime, bool memory)
        {
            return this.OpenWriter(null, entryName, dateTime, memory);
        }

        internal Stream OpenWriter(string fileName, string entryName, DateTime dateTime, bool memory)
        {
            return new ZipEntryStreamWriter(this, fileName, entryName, dateTime, memory);
        }

        private void ReadEntryHeaders(Stream fs)
        {
            this._entries.Clear();
            fs.Position = this._offset;
            while (true)
            {
                ZipEntry item = new ZipEntry(this);
                if (!item.ReadCentralHeader(fs))
                {
                    break;
                }
                this._entries.Add(item);
            }
        }

        public void Refresh()
        {
            this.Open(this._fileName);
        }

        internal void Remove(ZipEntry entry)
        {
            this.Remove(this._entries.IndexOf(entry));
        }

        internal void Remove(int index)
        {
            if (((this.FileName == null) || (this.FileName.Length == 0)) && (this._batchStream == null))
            {
                throw new ArgumentException(StringTables.GetString("Zip file is not open."));
            }
            if ((index < 0) || (index >= this.Entries.Count))
            {
                throw new IndexOutOfRangeException(StringTables.GetString("Invalid index or entry name."));
            }
            Stream fs = null;
            try
            {
                fs = this.OpenInternal(this.FileName);
                fs.SetLength(this._bytesBeforeZip + this._offset);
                long num = this.RemovePackedFile(fs, index);
                this._entries.RemoveAt(index);
                ZipEntryCollection entries = this.Entries;
                for (int i = index; i < entries.Count; i++)
                {
                    ZipEntry local1 = entries[i];
                    local1._offset -= num;
                }
                this.WriteCentralDir(fs);
            }
            finally
            {
                this.CloseInternal(fs);
            }
        }

        internal void Remove(int[] indices)
        {
            int[] array = (int[])indices.Clone();
            Array.Sort<int>(array);
            Stream fs = null;
            try
            {
                fs = this.OpenInternal(this.FileName);
                fs.SetLength(this._bytesBeforeZip + this._offset);
                int num = -1;
                ZipEntryCollection entries = this.Entries;
                for (int i = array.Length - 1; i >= 0; i--)
                {
                    int index = array[i];
                    if (((index >= 0) && (index < entries.Count)) && (index != num))
                    {
                        num = index;
                        long num4 = this.RemovePackedFile(fs, index);
                        this._entries.RemoveAt(index);
                        for (int j = index; j < entries.Count; j++)
                        {
                            ZipEntry local1 = entries[j];
                            local1._offset -= num4;
                        }
                    }
                }
                this.WriteCentralDir(fs);
            }
            finally
            {
                this.CloseInternal(fs);
            }
        }

        private long RemovePackedFile(Stream fs, int index)
        {
            ZipEntryCollection entries = this.Entries;
            if (index == (entries.Count - 1))
            {
                long num = entries[index]._offset + this._bytesBeforeZip;
                fs.SetLength(num);
                return 0L;
            }
            long num2 = entries[index]._offset + this._bytesBeforeZip;
            long num3 = entries[index + 1]._offset + this._bytesBeforeZip;
            long length = fs.Length - num3;
            long num5 = length;
            long num6 = 0L;
            int count = 0;
            byte[] buffer = this._buf;
            if (length > buffer.Length)
            {
                length = buffer.Length;
            }
            do
            {
                fs.Position = num3 + num6;
                count = fs.Read(buffer, 0, (int)length);
                if (count > 0)
                {
                    fs.Position = num2 + num6;
                    fs.Write(buffer, 0, count);
                }
                num6 += count;
            }
            while (count == length);
            if (num5 != num6)
            {
                throw new IOException(StringTables.GetString("Error writing data to Zip file (file may be corrupted)."));
            }
            long num8 = num3 - num2;
            fs.SetLength(fs.Length - num8);
            return num8;
        }

        internal void SetEntryComment(string entryName, string comment)
        {
            if (comment == null)
            {
                comment = string.Empty;
            }
            Stream fs = null;
            try
            {
                fs = this.OpenInternal(this.FileName);
                ZipEntry entry = this.Entries[entryName];
                if (entry == null)
                {
                    throw new IndexOutOfRangeException(string.Format(StringTables.GetString("Cannot find entry '{0}'."), entryName));
                }
                entry._comment = comment;
                fs.SetLength(this._bytesBeforeZip + this._offset);
                this.WriteCentralDir(fs);
            }
            finally
            {
                this.CloseInternal(fs);
            }
        }

        internal static void StreamCopy(Stream dstStream, Stream srcStream, long len)
        {
            byte[] buffer = new byte[0x40000];
            while (len > 0L)
            {
                int count = (int)Math.Min((long)buffer.Length, len);
                int num2 = srcStream.Read(buffer, 0, count);
                if (num2 == 0)
                {
                    break;
                }
                dstStream.Write(buffer, 0, num2);
                len -= (long)((ulong)num2);
            }
            dstStream.Flush();
        }

        internal bool StreamCopy(Stream dstStream, Stream srcStream, long len, string streamName)
        {
            ZipProgressEventArgs e = ((streamName != null) && (this.Progress != null)) ? new ZipProgressEventArgs(streamName, len) : null;
            if (e != null)
            {
                this.Progress(this, e);
                if (e.Cancel)
                {
                    return false;
                }
            }
            while (len > 0L)
            {
                int count = (int)Math.Min((long)this._buf.Length, len);
                int num2 = srcStream.Read(this._buf, 0, count);
                if (num2 == 0)
                {
                    break;
                }
                dstStream.Write(this._buf, 0, num2);
                len -= (long)((ulong)num2);
                if (e != null)
                {
                    e._position += num2;
                    this.Progress(this, e);
                    if (e.Cancel)
                    {
                        return false;
                    }
                }
            }
            dstStream.Flush();
            return true;
        }

        void IDisposable.Dispose()
        {
            this.CloseBatch();
        }

        internal void WriteCentralDir(Stream fs)
        {
            this.WriteEntryHeaders(fs);
            if (this.IsZip64())
            {
                this.WriteCentralDir64(fs);
            }
            this.WriteCentralDirEnd(fs);
        }

        private void WriteCentralDir64(Stream fs)
        {
            long position = fs.Position;
            BinaryWriter writer = new BinaryWriter(fs);
            writer.Write(CENTRAL_DIR64_SIGN);
            writer.Write((long)0x2cL);
            writer.Write((ushort)0x2d);
            writer.Write((ushort)0x2d);
            writer.Write((uint)0);
            writer.Write((uint)0);
            writer.Write((long)this.Entries.Count);
            writer.Write((long)this.Entries.Count);
            writer.Write((long)this._size);
            writer.Write(this._offset);
            writer.Write(CENTRAL_DIR64L_SIGN);
            writer.Write((uint)0);
            writer.Write(position);
            writer.Write((uint)1);
        }

        private void WriteCentralDirEnd(Stream fs)
        {
            int num = Math.Min(this._entries.Count, 0xffff);
            long num2 = Math.Min(this._offset, 0xffffffffL);
            byte[] bytes = ZipEncoding.Encoding.GetBytes(this._comment);
            BinaryWriter writer = new BinaryWriter(fs);
            writer.Write(CENTRAL_DIR_SIGN);
            writer.Write((ushort)0);
            writer.Write((ushort)0);
            writer.Write((ushort)num);
            writer.Write((ushort)num);
            writer.Write(this._size);
            writer.Write((uint)num2);
            writer.Write((ushort)bytes.Length);
            writer.Write(bytes);
        }

        private void WriteEntryHeaders(Stream fs)
        {
            ZipEntryCollection entries = this.Entries;
            this._offset = fs.Position - this._bytesBeforeZip;
            this._size = 0;
            for (int i = 0; i < entries.Count; i++)
            {
                this._size += entries[i].WriteCentralHeader(fs);
            }
        }

        // Properties
        public string Comment
        {
            get
            {
                return this._comment;
            }
            set
            {
                Stream fs = null;
                try
                {
                    fs = this.OpenInternal(this.FileName);
                    fs.SetLength(this._bytesBeforeZip + this._offset);
                    if (value == null)
                    {
                        value = string.Empty;
                    }
                    this._comment = value;
                    this.WriteCentralDir(fs);
                }
                finally
                {
                    this.CloseInternal(fs);
                }
            }
        }

        public CompressionLevelEnum CompressionLevel
        {
            get
            {
                return this._level;
            }
            set
            {
                this._level = value;
            }
        }

        public ZipEntryCollection Entries
        {
            get
            {
                return this._entries;
            }
        }

        public string FileName
        {
            get
            {
                return this._fileName;
            }
        }

        public int MemoryThreshold
        {
            get
            {
                return this._memoryThreshold;
            }
            set
            {
                this._memoryThreshold = value;
            }
        }

        public bool OverwriteHidden
        {
            get
            {
                return this._owHidden;
            }
            set
            {
                this._owHidden = value;
            }
        }

        public bool OverwriteReadOnly
        {
            get
            {
                return this._owReadOnly;
            }
            set
            {
                this._owReadOnly = value;
            }
        }

        public bool OverwriteSystem
        {
            get
            {
                return this._owSystem;
            }
            set
            {
                this._owSystem = value;
            }
        }

        public string Password
        {
            get
            {
                return this._password;
            }
            set
            {
                this._password = (value != null) ? value : string.Empty;
            }
        }

        public string TempFileName
        {
            get
            {
                return this._tempFileName;
            }
            set
            {
                this._tempFileName = value;
            }
        }
    }
}
